import houseList from '../src/data/house/fang_house.json'
import sand from '../src/data/house/sand.json'
import visitor from '../src/data/service/visitor.json'
import message from '../src/data/service/message.json'


export default {
    "GET /getList": houseList,
    "GET /getSand": sand,
    "GET /getVisitor": visitor,
    "GET /getMessage": (req: any, res: any) => {
        const { val } = req.query

        const newMessage = JSON.parse(JSON.stringify(message))
        const arr = newMessage.data.filter((item: any) => {
            
            return item.message.includes(val)
        })
        newMessage.data = arr
        res.send(newMessage) 
    }
    // "GET /abc": (req: any, res: any) => {
    //     console.log(req.query)
    //     res.end("ok")
    // }
}